//
//  LSBackButton.m
//  听说弱点强化训练
//
//  Created by 盛超 on 2018/8/22.
//  Copyright © 2018年 盛超. All rights reserved.
//

#import "LSBackButton.h"
#define imageWidth 15

@implementation LSBackButton

- (instancetype)initWithFrame:(CGRect)frame title:(NSString *)title image:(UIImage *)image {
    if (self = [super initWithFrame:frame]) {
        
        UIImageView *imageView = [[UIImageView alloc] init];
        imageView.image = [UIImage imageNamed:@"kz-关闭"];
        [self addSubview:imageView];
        [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self);
            make.centerY.equalTo(self);
            make.height.mas_equalTo(17);
            make.width.mas_equalTo(17);
        }];
        
        UIImageView *imageView2 = [[UIImageView alloc] init];
        imageView2.userInteractionEnabled = NO;
        imageView2.image = [UIImage imageNamed:@"LS-head_set"];
        [self addSubview:imageView2];
        [imageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(imageView.mas_right).offset(10);
            make.centerY.equalTo(self);
            make.size.mas_equalTo(CGSizeMake(15, 15));
        }];
        
        UILabel *titleLabel = [[UILabel alloc] init];
        titleLabel.userInteractionEnabled = NO;
        titleLabel.font = FONT(17);
        titleLabel.textColor = [UIColor whiteColor];
        titleLabel.text = title;
        [self addSubview:titleLabel];
        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(imageView2.mas_right).offset(6);
            make.centerY.equalTo(self);
            make.size.mas_equalTo(CGSizeMake(150, 17));
        }];
        
//        self.button = [[UIButton alloc] init];
//        self.button.backgroundColor = [UIColor redColor];
//        [self addSubview:self.button];
//        [self.button mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.right.top.bottom.equalTo(self);
//        }];
    }
    
    return self;
}
@end
